var  charts= {
    //世界地图流出
    map:(id,XAData)=>{
        var myChart = echarts.init(document.getElementById(id));
        var geoCoordMap = {
            '上海': [121.4648,31.2891],
            '东莞': [113.8953,22.901],
            '东营': [118.7073,37.5513],
            '中山': [113.4229,22.478],
            '临汾': [111.4783,36.1615],
            '临沂': [118.3118,35.2936],
            '丹东': [124.541,40.4242],
            '丽水': [119.5642,28.1854],
            '乌鲁木齐': [87.9236,43.5883],
            '佛山': [112.8955,23.1097],
            '保定': [115.0488,39.0948],
            '兰州': [103.5901,36.3043],
            '包头': [110.3467,41.4899],
            '北京': [116.4551,40.2539],
            '北海': [109.314,21.6211],
            '南京': [118.8062,31.9208],
            '南宁': [108.479,23.1152],
            '南昌': [116.0046,28.6633],
            '南通': [121.1023,32.1625],
            '厦门': [118.1689,24.6478],
            '台州': [121.1353,28.6688],
            '合肥': [117.29,32.0581],
            '呼和浩特': [111.4124,40.4901],
            '咸阳': [108.4131,34.8706],
            '哈尔滨': [127.9688,45.368],
            '唐山': [118.4766,39.6826],
            '嘉兴': [120.9155,30.6354],
            '大同': [113.7854,39.8035],
            '大连': [122.2229,39.4409],
            '天津': [117.4219,39.4189],
            '太原': [112.3352,37.9413],
            '威海': [121.9482,37.1393],
            '宁波': [121.5967,29.6466],
            '宝鸡': [107.1826,34.3433],
            '宿迁': [118.5535,33.7775],
            '常州': [119.4543,31.5582],
            '广州': [113.5107,23.2196],
            '廊坊': [116.521,39.0509],
            '延安': [109.1052,36.4252],
            '张家口': [115.1477,40.8527],
            '徐州': [117.5208,34.3268],
            '德州': [116.6858,37.2107],
            '惠州': [114.6204,23.1647],
            '成都': [103.9526,30.7617],
            '扬州': [119.4653,32.8162],
            '承德': [117.5757,41.4075],
            '拉萨': [91.1865,30.1465],
            '无锡': [120.3442,31.5527],
            '日照': [119.2786,35.5023],
            '昆明': [102.9199,25.4663],
            '杭州': [119.5313,29.8773],
            '枣庄': [117.323,34.8926],
            '柳州': [109.3799,24.9774],
            '株洲': [113.5327,27.0319],
            '武汉': [114.3896,30.6628],
            '汕头': [117.1692,23.3405],
            '江门': [112.6318,22.1484],
            '沈阳': [123.1238,42.1216],
            '沧州': [116.8286,38.2104],
            '河源': [114.917,23.9722],
            '泉州': [118.3228,25.1147],
            '泰安': [117.0264,36.0516],
            '泰州': [120.0586,32.5525],
            '济南': [117.1582,36.8701],
            '济宁': [116.8286,35.3375],
            '海口': [110.3893,19.8516],
            '淄博': [118.0371,36.6064],
            '淮安': [118.927,33.4039],
            '深圳': [114.5435,22.5439],
            '清远': [112.9175,24.3292],
            '温州': [120.498,27.8119],
            '渭南': [109.7864,35.0299],
            '湖州': [119.8608,30.7782],
            '湘潭': [112.5439,27.7075],
            '滨州': [117.8174,37.4963],
            '潍坊': [119.0918,36.524],
            '烟台': [120.7397,37.5128],
            '玉溪': [101.9312,23.8898],
            '珠海': [113.7305,22.1155],
            '盐城': [120.2234,33.5577],
            '盘锦': [121.9482,41.0449],
            '石家庄': [114.4995,38.1006],
            '福州': [119.4543,25.9222],
            '秦皇岛': [119.2126,40.0232],
            '绍兴': [120.564,29.7565],
            '聊城': [115.9167,36.4032],
            '肇庆': [112.1265,23.5822],
            '舟山': [122.2559,30.2234],
            '苏州': [120.6519,31.3989],
            '莱芜': [117.6526,36.2714],
            '菏泽': [115.6201,35.2057],
            '营口': [122.4316,40.4297],
            '葫芦岛': [120.1575,40.578],
            '衡水': [115.8838,37.7161],
            '衢州': [118.6853,28.8666],
            '西宁': [101.4038,36.8207],
            '西安': [109.1162,34.2004],
            '贵阳': [106.6992,26.7682],
            '连云港': [119.1248,34.552],
            '邢台': [114.8071,37.2821],
            '邯郸': [114.4775,36.535],
            '郑州': [113.4668,34.6234],
            '鄂尔多斯': [108.9734,39.2487],
            '重庆': [107.7539,30.1904],
            '金华': [120.0037,29.1028],
            '铜川': [109.0393,35.1947],
            '银川': [106.3586,38.1775],
            '镇江': [119.4763,31.9702],
            '长春': [125.8154,44.2584],
            '长沙': [113.0823,28.2568],
            '长治': [112.8625,36.4746],
            '阳泉': [113.4778,38.0951],
            '青岛': [120.4651,36.3373],
            '韶关': [113.7964,24.7028]
        };
        var planePath = 'arrow';
        var convertData = function (data) { // 地图数据处理
            var res = [];
            for (var i = 0; i < data.length; i++) {

                var dataItem = data[i];

                var fromCoord = geoCoordMap[dataItem[0].name];
                var toCoord = geoCoordMap[dataItem[1].name];
                if (fromCoord && toCoord) {
                    res.push({
                        fromName: dataItem[0].name,
                        toName: dataItem[1].name,
                        coords: [fromCoord, toCoord],
                        bancheName: dataItem[1].child[0].name,
                        bancheValue: dataItem[1].child[0].value,
                        lvyouName: dataItem[1].child[1].name,
                        lvyouValue: dataItem[1].child[1].value,
                        dangeName: dataItem[1].child[2].name,
                        dangeValue: dataItem[1].child[2].value
                    });
                }
            }
            return res;

        };
        var color = ['#FF8C28', '#FF8C28', '#FF8C28'];//航线的颜色
        var series = [];
        [['西安', XAData]].forEach(function (item, i) {
            series.push({
                    name: item[0] + ' Top3',
                    type: 'lines',
                    zlevel: 1,
                    effect: {
                        show: true,
                        period: 6,
                        trailLength: 0.7,
                        color: '#fff',   //arrow箭头的颜色
                        symbolSize: 3
                    },
                    lineStyle: {
                        normal: {
                            color: color[i],
                            width: 0,
                            curveness: 0.2
                        }
                    },
                    data: convertData(item[1])
                },
                {
                    name: item[0] + ' Top3',
                    type: 'lines',
                    zlevel: 2,
                    symbol: ['none', 'arrow'],
                    symbolSize: 10,
                    effect: {
                        show: true,
                        period: 6,
                        trailLength: 0,
                        symbol: planePath,
                        symbolSize: 8
                    },
                    lineStyle: {
                        normal: {
                            color: color[i],
                            width: 1,
                            opacity: 0.6,
                            curveness: 0.2
                        }
                    },
                    data: convertData(item[1])
                },
                {
                    name: item[0] + ' Top3',
                    type: 'effectScatter',
                    coordinateSystem: 'geo',
                    zlevel: 2,
                    rippleEffect: {
                        brushType: 'stroke'
                    },
                    label: {
                        normal: {
                            show: true,
                            position: 'right',
                            formatter: '{b}'
                        }
                    },
                    symbolSize: function (val) {
                        return val[2] / 8;
                    },
                    itemStyle: {
                        normal: {
                            color: color[i],
                        },
                        emphasis: {
                            areaColor: '#2B91B7'
                        }
                    },
                    data: item[1].map(function (dataItem) {
                        return {
                            name: dataItem[1].name,
                            value: geoCoordMap[dataItem[1].name].concat([dataItem[1].value])
                        };
                    })
                });
        });
        var option = {
            tooltip : {
                trigger: 'item',
                formatter:function(params, ticket, callback){
                    if(params.seriesType=="effectScatter") {
                        return "线路："+params.data.name+""+params.data.value[2];
                    }else if(params.seriesType=="lines"){
                        return params.data.fromName+"->"+params.data.toName+"<br />"
                            +params.data.bancheName+":"+params.data.bancheValue+"<br />"
                            +params.data.lvyouName+":"+params.data.lvyouValue+"<br />"
                            +params.data.dangeName+":"+params.data.dangeValue+"<br />"
                            ;
                    }else{
                        return params.name;
                    }
                }
            },
            geo: {
                map: 'china',
                label: {
                   show: true,
                    color:"#fff"
                },
                emphasis: {
                  show: true
                },
                // layoutCenter: ['10%', '10%'],
                roam: false,
                center: [105.97,34.71], // 设置当前地图的中心点：地图的位置
                itemStyle: {
                    normal: {
                        areaColor: { // 
                          type: 'linear',
                          x: 0,
                          y: 0,
                          x2: 0,
                          y2: 1,
                          colorStops: [{
                              offset: 0, color: '#07c8e1' // 0% 处的颜色
                          }, {
                              offset: 1, color: '#1b5fe6' // 100% 处的颜色
                          }],
                          global: false // 缺省为 false
                        },
                        borderColor: '#00f4fe',
                        borderWidth: 1,
                        shadowColor: 'rgba(255, 217, 248, 0.1)',
                        shadowOffsetX: 12,
                        shadowOffsetY: 12,
                        shadowBlur: 1
                    },
                    emphasis: {
                        areaColor: '#00f4fe' // 地图hover的背景色
                    }
                }
            },
            series: series,
        };
        myChart.setOption(option);

    },

    //陕西地图  首页
    creatMap:(id)=>{
        myChart = echarts.init(document.getElementById(id));
        var uploadedDataURL = "./js/shanxi1.json";
        var name = 'shanxi';
        $.get(uploadedDataURL, function(geoJson) {
            echarts.registerMap(name, geoJson);
            var data = [
                {name: '榆林市', value: 300},
                {name: '延安市', value: 399},
                {name: '铜川市', value: 150},
                {name: '渭南市', value: 99},
                {name: '咸阳市', value: 239},
                {name: '西安市', value: 223},
                {name: '陕西省', value: 199},
                {name: '商洛市', value: 259},
                {name: '安康市', value: 322},
                {name: '汉中市', value: 189}
            ];
            var geoCoordMap = {
                '榆林市': [109.741193,38.290162],
                '延安市': [109.49081,36.596537],
                '铜川市': [108.979608,35.316582],
                '渭南市': [109.902882,34.899381],
                '咸阳市': [108.405117,34.833439],
                '西安市': [108.939621,34.343147],
                '陕西省': [107.14487,34.369315],
                '商洛市': [109.918561,33.872706],
                '安康市': [109.029273,32.6903],
                '汉中市': [107.028621,33.077668]
            };
            var max = 480, min = 9;
            var convertData = function (data) {
                var res = [];
                for (var i = 0; i < data.length; i++) {
                    var geoCoord = geoCoordMap[data[i].name];
                    if (geoCoord) {
                        res.push({
                            name: data[i].name,
                            value: geoCoord.concat(data[i].value)
                        });
                    }
                }
                return res;
            };
            console.log(convertData(data))
            var option = {
                tooltip: { // 提示控件
                    show: true,
                    trigger: "item",
                    formatter: function(params) {
                        console.log(params)
                        if (params.data) return params.name + "：" + params.data["value"][2];
                    }
                },
                visualMap: { // 进度条控件
                    //颜色的设置  dataRange
                    show: true,
                    seriesIndex: [1],
                    min: min,
                    max: max,
                    text: ["高", "低"], // 文本，默认为数值文本
                    textStyle: {
                        color: "#fff"
                    },
                    inRange: {
                        color: [
                            "#1b5fe6",
                            "#07c8e1",
                        ]
                    }
                },
                geo: {
                    map: name,
                    itemStyle: {
                        color: "#fff"
                    }
                },
                series: [
                    {
                        name: "credit_pm2.5",
                        type: "effectScatter",
                        coordinateSystem: "geo",
                        data: convertData(data),
                        symbolSize: function(val) {
                            return 0.00000002;
                        },
                        label: {
                            normal: {
                                formatter: "{b}",
                                // position: "bottom",
                                color: "#fff",
                                show: true
                            }
                        },
                        itemStyle: {
                            normal: {
                                color: "#10f9ff",
                                shadowBlur: 0,
                                border: 0
                            }
                        },
                        zlevel: 1
                    },
                    {
                        type: "map",
                        mapType: name,
                        // zoom: 1.2, // 放大级别
                        roam: false, //是否开启鼠标缩放和平移漫游
                        itemStyle: {
                            //地图区域的多边形 图形样式
                            // color: ['rgb(11,85,142)', 'rgb(13,106,177)'],
                            normal: {
                                //是图形在默认状态下的样式
                                label: {
                                    show: true, //是否显示标签
                                    textStyle: {
                                        color: "transparent"
                                    }
                                },
                                borderWidth: 1,
                                borderColor: "#00faff",
                                areaColor: "#29b4b7"
                            },
                            emphasis: {
                                label: {
                                    show: false,
                                    textStyle: {
                                        color: "transparent"
                                    }
                                },
                                borderColor: "#00faff",
                                areaColor: "#9ea9f7"
                            }
                        },
                        data: data
                    }
                ]
            };
            myChart.setOption(option);
        })
    },

    //陕西地图  跨域分析
    creatMapKuayu:(id)=>{
        myChart = echarts.init(document.getElementById(id));
        var uploadedDataURL = "./js/shanxi1.json";
        var name = 'shanxi';
        $.get(uploadedDataURL, function(geoJson) {
            echarts.registerMap(name, geoJson);
            var data = [
                {name: '榆林市', value: 300},
                {name: '延安市', value: 399},
                {name: '铜川市', value: 150},
                {name: '渭南市', value: 99},
                {name: '咸阳市', value: 239},
                {name: '西安市', value: 223},
                {name: '陕西省', value: 199},
                {name: '商洛市', value: 259},
                {name: '安康市', value: 322},
                {name: '汉中市', value: 189}
            ];
            var geoCoordMap = {
                '榆林市': [109.741193,38.290162],
                '延安市': [109.49081,36.596537],
                '铜川市': [108.979608,35.316582],
                '渭南市': [109.902882,34.899381],
                '咸阳市': [108.405117,34.833439],
                '西安市': [108.939621,34.343147],
                '陕西省': [107.14487,34.369315],
                '商洛市': [109.918561,33.872706],
                '安康市': [109.029273,32.6903],
                '汉中市': [107.028621,33.077668]
            };
            var max = 480, min = 9;
            var convertData = function (data) {
                var res = [];
                for (var i = 0; i < data.length; i++) {
                    var geoCoord = geoCoordMap[data[i].name];
                    if (geoCoord) {
                        res.push({
                            name: data[i].name,
                            value: geoCoord.concat(data[i].value)
                        });
                    }
                }
                return res;
            };
            console.log(convertData(data))
            var option = {
                tooltip: { // 提示控件
                    show: true,
                    trigger: "item",
                    formatter: function(params) {
                        console.log(params)
                        if (params.data) return params.name + "：" + params.data["value"][2];
                    }
                },
                visualMap: { // 进度条控件
                    //颜色的设置  dataRange
                    show: true,
                    seriesIndex: [1],
                    min: min,
                    max: max,
                    text: ["高", "低"], // 文本，默认为数值文本
                    textStyle: {
                        color: "#fff"
                    },
                    inRange: {
                        color: [
                            "#1b5fe6",
                            "#07c8e1",
                        ]
                    }
                },
                geo: {
                    map: name,
                    left: "170",
                    top: "95",
                    itemStyle: {
                        color: "#fff"
                    }
                },
                series: [
                    {
                        name: "credit_pm2.5",
                        type: "effectScatter",
                        coordinateSystem: "geo",
                        data: convertData(data),
                        symbolSize: function(val) {
                            return 0.00000002;
                        },
                        label: {
                            normal: {
                                formatter: "{b}",
                                // position: "bottom",
                                color: "#fff",
                                show: true
                            }
                        },
                        itemStyle: {
                            normal: {
                                color: "#10f9ff",
                                shadowBlur: 0,
                                border: 0
                            }
                        },
                        zlevel: 1
                    },
                    {
                        type: "map",
                        mapType: name,
                        // zoom: 1.2, // 放大级别
                        roam: false, //是否开启鼠标缩放和平移漫游
                        itemStyle: {
                            //地图区域的多边形 图形样式
                            // color: ['rgb(11,85,142)', 'rgb(13,106,177)'],
                            normal: {
                                //是图形在默认状态下的样式
                                label: {
                                    show: true, //是否显示标签
                                    textStyle: {
                                        color: "transparent"
                                    }
                                },
                                borderWidth: 1,
                                borderColor: "#00faff",
                                areaColor: "#29b4b7"
                            },
                            emphasis: {
                                label: {
                                    show: false,
                                    textStyle: {
                                        color: "transparent"
                                    }
                                },
                                borderColor: "#00faff",
                                areaColor: "#9ea9f7"
                            }
                        },
                        data: data
                    }
                ]
            };
            myChart.setOption(option);
        })
    },

    // 区县图
    creatQXMap:(id)=>{
      myChart = echarts.init(document.getElementById(id));
      var uploadedDataURL = "./js/xian.json";
      var name = 'xian';
      $.get(uploadedDataURL, function(geoJson) {
          echarts.registerMap(name, geoJson);
          var data = [
              {name: '榆林市', value: 300},
              {name: '延安市', value: 399},
              {name: '铜川市', value: 150},
              {name: '渭南市', value: 99},
              {name: '咸阳市', value: 239},
              {name: '西安市', value: 223},
              {name: '陕西省', value: 199},
              {name: '商洛市', value: 259},
              {name: '安康市', value: 322},
              {name: '汉中市', value: 189}
          ];
          var geoCoordMap = {
            '陕西省': [108.948024, 34.263161],
            '甘肃省': [103.823557, 36.058039],
            '山西省': [112.549248, 37.857014],
            '河北省': [114.502461, 38.045474],
            '西安市': [108.948024, 34.263161],
            '榆林市': [109.741193, 38.290162],
            '雁塔区': [108.94866, 34.22245],
            '未央区': [108.94683, 34.29296]
          };
          var max = 480, min = 9;
          var convertData = function (data) {
            var res = [];
            for (var i = 0; i < data.length; i++) {
                var geoCoord = geoCoordMap[data[i].name];
                if (geoCoord) {
                    res.push({
                        name: data[i].name,
                        value: geoCoord.concat(data[i].value)
                    });
                }
            }
            return res;
        };
          var color = ["#a6c84c", "#46bee9", "#ffa022"];
          console.log(convertData(data))
          var option = {
            tooltip: { // 提示控件
                show: true,
                trigger: "item",
                formatter: function(params) {
                    console.log(params)
                    if (params.data) return params.name + "：" + params.data["value"][2];
                }
            },
            visualMap: { // 进度条控件
                //颜色的设置  dataRange
                show: false,
                seriesIndex: [1],
                min: min,
                max: max,
                text: ["高", "低"], // 文本，默认为数值文本
                textStyle: {
                    color: "#fff"
                },
                inRange: {
                    color: [
                        "#1b60e6",
                        "#07c8e1",
                    ]
                }
            },
            geo: {
                map: name,
                // left: "50",
                // top: "50",
                zoom: 1,
                itemStyle: {
                    // color: "#fff",
                    // areaColor: "#29b4b7",
                    // borderWidth: 1,
                    // borderColor: "#00faff",
                    normal: {
                      areaColor: { // 
                        type: 'linear',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: '#07c8e1' // 0% 处的颜色
                        }, {
                            offset: 1, color: '#1b5fe6' // 100% 处的颜色
                        }],
                        global: false // 缺省为 false
                      },
                      borderColor: '#00f4fe',
                      borderWidth: 1,
                      shadowColor: 'rgba(255, 217, 248, 0.1)',
                      shadowOffsetX: 12,
                      shadowOffsetY: 12,
                      shadowBlur: 1
                  }
                }
            },
            series: [
                // {
                //     name: "credit_pm2.5",
                //     type: "effectScatter",
                //     coordinateSystem: "geo",
                //     data: convertData(data),
                //     symbolSize: function(val) {
                //         return 0.00000002;
                //     },
                //     label: {
                //         normal: {
                //             formatter: "{b}",
                //             position: "bottom",
                //             color: "#fff",
                //             show: true
                //         }
                //     },
                //     itemStyle: {
                //         normal: {
                //             color: "#07c8e1",
                //             shadowBlur: 0,
                //             border: 0
                //         }
                //     },
                //     zlevel: 1
                // },
                {
                    type: "map",
                    mapType: name,
                    // zoom: 1.2, // 放大级别
                    roam: false, //是否开启鼠标缩放和平移漫游
                    itemStyle: {
                        //地图区域的多边形 图形样式
                        // color: ['rgb(11,85,142)', 'rgb(13,106,177)'],
                        normal: {// 地图默认样式
                            label: {
                                show: true, //是否显示标签 地图文字
                                textStyle: {
                                    color: "#fff"
                                }
                            },
                            borderWidth: 1,
                            borderColor: "#07c8e1",
                            areaColor: { // 
                              type: 'linear',
                              x: 0,
                              y: 0,
                              x2: 0,
                              y2: 1,
                              colorStops: [{
                                  offset: 0, color: '#07c8e1' // 0% 处的颜色
                              }, {
                                  offset: 1, color: '#1b5fe6' // 100% 处的颜色
                              }],
                              global: false // 缺省为 false
                            },
                        },
                        emphasis: { // 高亮状态样式 hover样式
                            label: {
                                show: false,
                                textStyle: {
                                    color: "#fff"
                                }
                            },
                            borderColor: "#28729f", // 9ea9f7  
                            areaColor: "#07c8e1"
                        }
                    },
                    data: data
                }
            ]
        };
          myChart.setOption(option);
      })
  }, 

    //线图;
    LinesArea: (legendData,xAxisData,chartData,color,yTitle) => {
      // var  myChart = echarts.init(document.getElementById(id));
      // $("#" + id).css({"width":$("#" + id).width() + "px","height":$("#" + id).height() + "px"});
      yTitle = yTitle || ''
      let dataRoom = []
      if (xAxisData && xAxisData.length > 6) {
            dataRoom = [{
                show: true,
                height: 12,
                xAxisIndex: [0],
                bottom:'15',
                start: 10,
                end: 70,
                handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
                handleSize: '110%',
                handleStyle:{
                    color:"#d3dee5",

                },
                textStyle:{
                    color:"#fff"},
                borderColor:"#90979c"
          }]
      }
      var  formatter,series=[];
      for(var i=0;i<legendData.length;i++){
          series.push({
              name: legendData[i],
              type: 'bar',
              itemStyle: {
                  normal: {
                      show: true,
                      color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                          offset: 0,
                          color: color[i][0]
                      }, {
                          offset: 1,
                          color: color[i][1]
                      }]),
                  }
              },
              label: {
                  normal: {
                      show: true,
                      position: 'top',
                      textStyle: {
                          color: '#fff'
                      }
                  }
              },
              barWidth: '20%',
              data: chartData[i]
          },);
      };
      return option = {
            tooltip: {
                trigger: 'axis',
            },
            legend: {
                orient: 'horizontal',
                left: "center",
                data: legendData,
                textStyle: {
                    color: '#d0d0d0',
                },
                top: "5%",
            },
            grid: {
                left: '3%',
                right: '8%',
                bottom: '40',
                containLabel: true
            },
            calculable: true,
            textStyle:{
                color:'#fff',
            },
            dataZoom: dataRoom,
            yAxis: {
                type: 'value',
                name: yTitle,
                nameTextStyle:{
                    fontSize:14,
                },
                axisLine:{
                    lineStyle:{
                        color:'rgba(31,47,96,0.5)',
                    }
                },
                splitLine:{
                    show:false
                }
            },
            xAxis: [{
                type: 'category',
                axisTick: {
                    show: false
                },
                axisLine: {
                    show: true,
                    lineStyle: {
                        color: '#fff',
                    }
                },
                splitLine:{
                    show:true,
                    lineStyle:{
                        color:"rgba(31,47,96,0.5)"
                    }
                },
                axisLabel: {
                    //interval:0,
                },
                data: xAxisData
            }],
            series: series
        };

    },

    //饼图
    pies: (id,dataRound,roundData,tubiao,color) =>{
      var myChart =echarts.init(document.getElementById(id))
      // $("#" + id).css({"width":$("#" + id).width() + "px","height":$("#" + id).height() + "px"});
      var option = {
          tooltip: {
              trigger: 'item',
              formatter: "{b} : {d}% <br/> {c}"
          },
          legend: {
              orient: 'horizontal',
              icon: tubiao,
              left: "30%",
              bottom: "5%",
              x: 'center',
              data:dataRound,
              textStyle:{
                  color:color
              }
          },
          series: [
            {
              type: 'pie',
              name: '',
              radius: ['55%', '68%'],
              center: ['40%', '45%'],
              avoidLabelOverlap: false,
              silent: true,
              label: {
                  normal: {
                      show:false,
                  }
              },
              data: [{
                  value: 1,
                  itemStyle: {
                      normal: {
                          color: '#0E3065',
                      }
                  }
              }]
            },
            {
              type: 'pie',
              radius: ['40%', '55%'],
              center: ['40%', '45%'],
              color: ['#028CFE', '#FCDE49', '#00FFFF','#FA8A26','#69a2f9','#67defc','#FAD860',"#CBD570","#FCCE10","#E87C25","#9BCA63"],
              data: roundData,
              selectedMode: 'single',
              z:6,
              /*labelLine: {
                  normal: {
                      show: true,
                      length: 10,
                      length2: 20,
                      lineStyle: {
                          color: '#d0d0d0',
                          width: 1
                      }
                  }
              },*/
              label: {
                  normal: {
                      show:true,
                      /*position:"center",
                      formatter: function(params){
                          console.log(params.name);
                          return params.name+params.percent
                      }*/
                  }
              }
            }
          ]
      };
      myChart.clear();
      myChart.setOption(option);
    },
    // 
    piesScore:(id,data)=>{
        var  myChart = echarts.init(document.getElementById(id),'light');
        var option = {
            color: ['rgba(255, 212, 251, 1)'],
            series: [{
                name: 'Line 1',
                type: 'pie',
                clockWise: true,
                radius: ['85%', '100%'],
                itemStyle: {
                    normal: {
                        label: {
                            show: false
                        },
                        labelLine: {
                            show: false
                        }
                    }
                },
                hoverAnimation: false,
                data: [{
                    value: data,
                    name: '已使用',
                    itemStyle: {
                        normal: {
                            color: "#367bec",
                        }
                    }
                }, {
                    name: '未使用',
                    value: 100-data
                }]
            }]
        };
        myChart.setOption(option);

    },

    // 企业安全报告 线图
    reportChartsLine: (id,titleName, legendName, name, zhudongNumber, shiguNumber, weiguiNumber, timeDifference, alarmRate) => {
      var myChart =echarts.init(document.getElementById(id), 'macarons');
      $("#" + id).css({"width":$("#" + id).width() + "px","height":$("#" + id).height() + "px"});
      const animationDuration = 4000
      var maxy = parseInt(zhudongNumber[0])
      maxy < 5 ? maxy = 5 : maxy
      for (var i = 1; i < zhudongNumber.length; i++) {
        var cur = parseInt(zhudongNumber[i])
        cur > maxy ? maxy = cur : maxy
      }
      maxy = Math.ceil(maxy / 10) * 10
      var option = {
        title: { // 标题组件
          show: true,
          text: titleName,
          textStyle: {
            color: '#fff',
            fontWeight: 'bold',
            fontSize: 16
          }
        },
        tooltip: { // 提示框组件
          trigger: 'axis',
          axisPointer: { // 坐标轴指示器，坐标轴触发有效
            type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
          },
          formatter: function(datas) {
            let res = datas[0].name + '<br/>'
            for (var i = 0, length = datas.length; i < length; i++) {
              let item = ''
              if (datas[i].seriesName === '处理率') {
                item = '<div class="j-circle" ><span style="background:' + datas[i].color + '"></span>' + datas[i].seriesName + '：' + datas[i].value + '%<br/>'
              } else if (datas[i].seriesName === '报警平均处理时长') {
                item = '<div class="j-circle" ><span style="background:' + datas[i].color + '"></span>' + datas[i].seriesName + '：' + datas[i].value + 's<br/>'
              } else {
                item = '<div class="j-circle" ><span style="background:' + datas[i].color + '"></span>' + datas[i].seriesName + '：' + datas[i].value + '<br/>'
              }
              res += item
            }
            return res
          }
        },
        legend: { // 图例组件
          left: 'right',
          right: '5%',
          data: legendName,
          textStyle: {
            color: '#fff'
          }
        },
        grid: {
          top: 60,
          left: 10,
          right: 50,
          bottom: 20,
          containLabel: true // grid区域内是否包含坐标柱的刻度标签，这常用于『防止标签溢出』的场景，
                            // 标签溢出指的是，标签长度动态变化时，可能会溢出容器或者覆盖其他组件。
        },
        xAxis: [{
          type: 'category',
          data: name,
          // gridIndex: 0, // x 轴所在的 grid 的索引，默认位于第一个 grid。
          axisLabel: { // 坐标轴刻度标签的相关设置。
            color: '#fff',
            interval: 0, // 坐标轴刻度标签的显示间隔，在类目轴中有效。
            rotate: 40,
            inside: false, // 刻度标签是否朝内，默认朝外。
            // formatter: function(value) { // 刻度标签的内容格式器
            //   // if (value.length <= 8) return value
            //   // else return value.substring(0, 8) + '...'
            // }
          },
          axisTick: {
            alignWithLabel: true // 类目轴中在 boundaryGap 为 true，可以保证刻度线和标签对齐
          },
          // boundaryGap: true, // 坐标轴两边留白策略
          axisPointer: {
            type: 'shadow' // 指示器类型
          }
        }],
        yAxis: [
          {
            type: 'value',
            name: '(次数)',
            max: maxy,
            axisLabel: {
              formatter: '{value}'
            },
            axisLine: {
              lineStyle: {
                color: '#fff'
              }
            }
          },
          {
            type: 'value',
            name: '(百分比%)',
            position: 'right',
            offset: 70,
            axisLabel: {
              formatter: '{value} %'
            },
            axisLine: {
              lineStyle: {
                color: '#FCA12C'
              }
            }
          },
          {
            type: 'value',
            name: '(时间m)',
            position: 'right',
            axisLabel: {
              formatter: '{value} m'
            },
            axisLine: {
              lineStyle: {
                color: '#ff547a'
              }
            }
          }
        ],
        series: [
          {
            name: '主动安全报警',
            type: 'bar',
            // barGap: '-100%',
            // barWidth: 7,
            data: zhudongNumber,
            barMaxWidth: 20,
            itemStyle: {
              normal: {
                barBorderRadius: [5, 5, 0, 0],
                color: '#27DDAA'
              }
            },
            animationDuration
          },
          {
            name: '事故报警',
            type: 'bar',
            // barWidth: 7,
            barMaxWidth: 20,
            data: shiguNumber,
            itemStyle: {
              normal: {
                barBorderRadius: [5, 5, 0, 0],
                color: '#B8DDFA'
              }
            },
            animationDuration
          },
          {
            name: '违规报警',
            type: 'bar',
            // barWidth: 7,
            barMaxWidth: 20,
            data: weiguiNumber,
            itemStyle: {
              normal: {
                barBorderRadius: [5, 5, 0, 0],
                color: '#A695FD'
              }
            },
            animationDuration
          },
          {
            name: '报警平均处理时长',
            type: 'line',
            yAxisIndex: 2,
            barWidth: 7,
            data: timeDifference,
            itemStyle: {
              normal: {
                barBorderRadius: [5, 5, 0, 0],
                color: '#ff547a'
              }
            },
            animationDuration
          },
          {
            name: '处理率',
            type: 'line',
            yAxisIndex: 1,
            data: alarmRate,
            lineStyle: {
              normal: {
                color: '#FCA12C'
              }
            },
            itemStyle: {
              normal: {
                color: '#FCA12C'
              }
            },
            animationDuration
          }
        ],
        label: {
          normal: {
            show: false,
            position: 'top'
          }
        }
      }
      myChart.setOption(option);
      return myChart;
    },

    // 企业安全报告 饼图
    reportChartsPie: (id,titleName, alarmName, count) => {
      var myChart =echarts.init(document.getElementById(id));
      $("#" + id).css({"width":$("#" + id).width() + "px","height":$("#" + id).height() + "px"});
      var option = {
        title: { // 标题
          show: true,
          text: titleName,
          textStyle: {
            color: '#fff',
            fontWeight: 'bold',
            fontSize: 16
          }
        },
        tooltip: {
          trigger: 'item',
          formatter: '{a} <br/>{b} : {c} ({d}%)'
        },
        legend: {
          orient: 'vertical', // 图例列表的布局朝向。
          // align: "auto", // 图例标记和文本的对齐
          // itemGap: "", // 图例每项之间的间隔
          selectedMode: true, // 图例选择的模式，控制是否可以通过点击图例改变系列的显示状态
          x: 'left',
          left: 20,
          top: 50,
          data: alarmName,
          textStyle: {
            color: '#fff'
          },
        },
        calculable: true, // 是否显示拖拽用的手柄
        series: [ // 系列列表 配置项
          {
            name: '',
            type: 'pie',
            radius: [60, 100],
            center: ['60%', '50%'],
            avoidLabelOverlap: false, // 是否启用防止标签重叠策略,在标签拥挤重叠的情况下会挪动各个标签的位置，防止标签间的重叠。
            label: { // 文本标签
              normal: {
                show: false,
                position: 'center' // 标签文本显示在中心位置
              },
              emphasis: {
                show: true,
                textStyle: {
                  fontSize: '16',
                  fontWeight: 'bold',
                  color: '#fff'
                }
              }
            },
            labelLine: { // 视觉引导线样式
              normal: {
                show: false
              }
            },
            data: count,
            animationEasing: 'cubicInOut', // 初始动画的缓动效果，图标的渲染效果
            animationDuration: 2600 // 初始动画的时长
          }
        ]
      };
      myChart.setOption(option);
    },
    /**
     * 统计分析--报警信息统计--系统报警汇总
     */
    systemWarnPie: (id,dataRound,roundData,tubiao,color,pieCorlor)=>{
        // let testData = roundData;
        // testData[0].value = 20;
        var myChart =echarts.init(document.getElementById(id));
        var option = {
            tooltip: {
                trigger: 'item',
                formatter: "{a} <br/>{b}: {c} ({d}%)"
            },
            legend: {
                orient: 'vertical',
                x: 'right',
                bottom:"10%",
                left: "80%",
                // bottom: "5%",
                // x: 'center',
                icon:tubiao,
                // data:['已处理','未处理']
                data:dataRound,
                textStyle:{
                    color: color
                }
            },
            // color:["#ffd11b",'#3e6afa'],
            color:pieCorlor,
            series: [
                {
                    name:'系统报警汇总',
                    type:'pie',
                    radius: ['40%', '60%'],
                    avoidLabelOverlap: false,
                    label: {
                        normal: {
                            show: true,
                            position: 'outside',
                            textStyle: {
                                fontSize: '16'
                            }
                        },
                        emphasis: {
                            show: true
                        }
                    },
                    labelLine:{
                        normal:{  
                            length:42
                        }  
        
                    },
                    // data:testData
                    data:roundData
                }
            ]
        };
        myChart.clear();
        myChart.setOption(option);
    },
    up:(obj) => {
        var item=obj.el;
        var num=obj.max;
        if(num<=100){
            var start=0;
        }else{
            var start=num-100;
        }

        time2=setInterval(function(){
            start++;
            if(start>num){
                start=num;
                clearInterval(time2);
            }
            item.text(start)
        },10)
    },
};